macro(ADD_PP_FILES outfiles)
    foreach(it ${ARGN})
        get_filename_component(outbase ${it} NAME_WE)
        get_filename_component(infile ${it} ABSOLUTE)
        set(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outbase}.c++)

        add_custom_command(OUTPUT ${outfile}
            COMMAND ppp < ${infile} > ${outfile}
            MAIN_DEPENDENCY ${infile}
            VERBATIM)
        set(${outfiles} ${${outfiles}} ${outfile})
    endforeach ()
endmacro()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
bison_target(CALCPARSE
    database/src/so/engines/SoCalcParse.y
    ${CMAKE_CURRENT_BINARY_DIR}/SoCalcParse.c++
)

add_pp_files(PP_SOURCES
    database/src/so/nodes/SoCone.pp
    database/src/so/nodes/SoCube.pp
    database/src/so/nodes/SoCylinder.pp
    database/src/so/nodes/SoFaceSet.pp
    database/src/so/nodes/SoIndexedFaceSet.pp
    database/src/so/nodes/SoIndexedLineSet.pp
    database/src/so/nodes/SoLineSet.pp
    database/src/so/nodes/SoPointSet.pp
    database/src/so/nodes/SoIndexedTriangleStripSet.pp
    database/src/so/nodes/SoQuadMesh.pp
    database/src/so/nodes/SoSphere.pp
    database/src/so/nodes/SoTriangleStripSet.pp
)

add_library(Inventor)

target_sources(Inventor
    PRIVATE
    ${PP_SOURCES}
    database/src/sb/projectors/SbProjectors.c++
    database/src/sb/Sb.c++
    database/src/so/actions/SoActions.c++
    database/src/so/bundles/SoBundles.c++
    database/src/so/caches/SoCaches.c++
    database/src/so/details/SoDetails.c++
    database/src/so/elements/SoElement.c++
    database/src/so/elements/SoElements.c++
    database/src/so/engines/SoEngines.c++
    database/src/so/engines/SoConcatenate.c++
    database/src/so/engines/SoEngineInit.c++
    database/src/so/engines/SoFieldConverters.c++
    database/src/so/engines/SoGate.c++
    database/src/so/engines/SoSelectOne.c++
    database/src/so/errors/SoErrors.c++
    database/src/so/errors/SoErrorInit.c++
    database/src/so/events/SoEventInit.c++
    database/src/so/events/SoEvents.c++
    database/src/so/fields/SoField.c++
    database/src/so/fields/SoFieldContainer.c++
    database/src/so/fields/SoFieldData.c++
    database/src/so/fields/SoFieldInit.c++
    database/src/so/fields/SoFields.c++
    database/src/so/fields/SoGlobalField.c++
    database/src/so/nodes/nurbs/clients/nurbsClient.c++
    database/src/so/nodes/nurbs/libnurbs/libNurbs.c++
    database/src/so/nodes/nurbs/SoNurbs.c++
    database/src/so/nodes/SoNode.c++
    database/src/so/nodes/SoNodeInit.c++
    database/src/so/nodes/SoAnnotation.c++
    database/src/so/nodes/SoArray.c++
    database/src/so/nodes/SoAsciiText.c++
    database/src/so/nodes/SoBaseColor.c++
    database/src/so/nodes/SoBlinker.c++
    database/src/so/nodes/SoCallback.c++
    database/src/so/nodes/SoCamera.c++
    database/src/so/nodes/SoClipPlane.c++
    database/src/so/nodes/SoColorIndex.c++
    database/src/so/nodes/SoComplexity.c++
    database/src/so/nodes/SoCoordinate3.c++
    database/src/so/nodes/SoCoordinate4.c++
    database/src/so/nodes/SoDrawStyle.c++
    database/src/so/nodes/SoDirectionalLight.c++
    database/src/so/nodes/SoEnvironment.c++
    database/src/so/nodes/SoFile.c++
    database/src/so/nodes/SoFont.c++
    database/src/so/nodes/SoGroup.c++
    database/src/so/nodes/SoEventCallback.c++
    database/src/so/nodes/SoFontStyle.c++
    database/src/so/nodes/SoInfo.c++
    database/src/so/nodes/SoIndexedNurbsCurve.c++
    database/src/so/nodes/SoIndexedShape.c++
    database/src/so/nodes/SoLOD.c++
    database/src/so/nodes/SoLabel.c++
    database/src/so/nodes/SoLight.c++
    database/src/so/nodes/SoIndexedNurbsSurface.c++
    database/src/so/nodes/SoLevelOfDetail.c++
    database/src/so/nodes/SoMaterial.c++
    database/src/so/nodes/SoLocateHighlight.c++
    database/src/so/nodes/SoLightModel.c++
    database/src/so/nodes/SoLinearProfile.c++
    database/src/so/nodes/SoNormal.c++
    database/src/so/nodes/SoMaterialBinding.c++
    database/src/so/nodes/SoMultipleCopy.c++
    database/src/so/nodes/SoNurbsCurve.c++
    database/src/so/nodes/SoNurbsProfile.c++
    database/src/so/nodes/SoMatrixTransform.c++
    database/src/so/nodes/SoNurbsSurface.c++
    database/src/so/nodes/SoPackedColor.c++
    database/src/so/nodes/SoPendulum.c++
    database/src/so/nodes/SoNonIndexedShape.c++
    database/src/so/nodes/SoPathSwitch.c++
    database/src/so/nodes/SoProfile.c++
    database/src/so/nodes/SoNormalBinding.c++
    database/src/so/nodes/SoRotation.c++
    database/src/so/nodes/SoPickStyle.c++
    database/src/so/nodes/SoRotor.c++
    database/src/so/nodes/SoPointLight.c++
    database/src/so/nodes/SoScale.c++
    database/src/so/nodes/SoShape.c++
    database/src/so/nodes/SoShuttle.c++
    database/src/so/nodes/SoOrthographicCamera.c++
    database/src/so/nodes/SoRotationXYZ.c++
    database/src/so/nodes/SoSwitch.c++
    database/src/so/nodes/SoText2.c++
    database/src/so/nodes/SoPerspectiveCamera.c++
    database/src/so/nodes/SoProfileCoordinate2.c++
    database/src/so/nodes/SoProfileCoordinate3.c++
    database/src/so/nodes/SoResetTransform.c++
    database/src/so/nodes/SoSeparator.c++
    database/src/so/nodes/SoShapeHints.c++
    database/src/so/nodes/SoText3.c++
    database/src/so/nodes/SoSpotLight.c++
    database/src/so/nodes/SoTexture2.c++
    database/src/so/nodes/SoTextureCoordinate2.c++
    database/src/so/nodes/SoTransform.c++
    database/src/so/nodes/SoTextureCoordinateBinding.c++
    database/src/so/nodes/SoUnits.c++
    database/src/so/nodes/SoTransformation.c++
    database/src/so/nodes/readGIF.c
    database/src/so/nodes/SoTranslation.c++
    database/src/so/nodes/SoUnknownNode.c++
    database/src/so/nodes/SoVertexShape.c++
    database/src/so/nodes/SoWWWAnchor.c++
    database/src/so/nodes/SoTextureCoordinateDefault.c++
    database/src/so/nodes/SoVertexProperty.c++
    database/src/so/nodes/SoTextureCoordinateFunction.c++
    database/src/so/nodes/SoTextureCoordinateEnvironment.c++
    database/src/so/nodes/SoTextureCoordinatePlane.c++
    database/src/so/nodes/SoTexture2Transform.c++
    database/src/so/nodes/SoTransformSeparator.c++
    database/src/so/nodes/SoWWWInline.c++
    database/src/so/sensors/SoSensors.c++
    database/src/so/upgraders/SoUpgraderInit.c++
    database/src/so/upgraders/SoUpgrader.c++
    database/src/so/upgraders/SoUpgraders.c++
    database/src/so/So.c++
    database/src/so/SoState.c++
    database/src/so/linux.c++

    database/src/so/engines/SoCalcExpr.h
    database/src/so/engines/SoEngineUtil.h
    database/src/so/engines/SoFieldConverters.h
    database/src/so/fields/SoGlobalField.h
    database/src/so/nodes/nurbs/SoCurveRenderEval.h
    database/src/so/nodes/nurbs/SoPickEvals.h
    database/src/so/nodes/nurbs/SoPrimEvals.h
    database/src/so/nodes/nurbs/_defines.h
    database/src/so/nodes/nurbs/_undefs.h
    database/src/so/nodes/nurbs/clients/gl4curveval.h
    database/src/so/nodes/nurbs/clients/gl4surfeval.h
    database/src/so/nodes/nurbs/clients/gl4types.h
    database/src/so/nodes/nurbs/clients/isocurveeval.h
    database/src/so/nodes/nurbs/clients/softcurvemaps.h
    database/src/so/nodes/nurbs/clients/softcurveval.h
    database/src/so/nodes/nurbs/clients/softcurvmap.h
    database/src/so/nodes/nurbs/clients/softrenderer.h
    database/src/so/nodes/nurbs/clients/softsurfacemaps.h
    database/src/so/nodes/nurbs/clients/softsurfeval.h
    database/src/so/nodes/nurbs/clients/softsurfmap.h
    database/src/so/nodes/nurbs/clients/typestringtable.h
    database/src/so/nodes/nurbs/clients/gl4base.h
    database/src/so/nodes/nurbs/head/arc.h
    database/src/so/nodes/nurbs/head/arcsorter.h
    database/src/so/nodes/nurbs/head/arctess.h
    database/src/so/nodes/nurbs/head/backend.h
    database/src/so/nodes/nurbs/head/basiccrveval.h
    database/src/so/nodes/nurbs/head/basicsurfeval.h
    database/src/so/nodes/nurbs/head/bezierarc.h
    database/src/so/nodes/nurbs/head/bin.h
    database/src/so/nodes/nurbs/head/bufpool.h
    database/src/so/nodes/nurbs/head/cachingeval.h
    database/src/so/nodes/nurbs/head/coveandtiler.h
    database/src/so/nodes/nurbs/head/curve.h
    database/src/so/nodes/nurbs/head/curvelist.h
    database/src/so/nodes/nurbs/head/defines.h
    database/src/so/nodes/nurbs/head/displaylist.h
    database/src/so/nodes/nurbs/head/displaymode.h
    database/src/so/nodes/nurbs/head/flist.h
    database/src/so/nodes/nurbs/head/flistsorter.h
    database/src/so/nodes/nurbs/head/gridline.h
    database/src/so/nodes/nurbs/head/gridtrimvertex.h
    database/src/so/nodes/nurbs/head/gridvertex.h
    database/src/so/nodes/nurbs/head/hull.h
    database/src/so/nodes/nurbs/head/jarcloc.h
    database/src/so/nodes/nurbs/head/jumpbuffer.h
    database/src/so/nodes/nurbs/head/knot.h
    database/src/so/nodes/nurbs/head/knotvector.h
    database/src/so/nodes/nurbs/head/mapdesc.h
    database/src/so/nodes/nurbs/head/maplist.h
    database/src/so/nodes/nurbs/head/mesher.h
    database/src/so/nodes/nurbs/head/myassert.h
    database/src/so/nodes/nurbs/head/myglimports.h
    database/src/so/nodes/nurbs/head/mysetjmp.h
    database/src/so/nodes/nurbs/head/mystdlib.h
    database/src/so/nodes/nurbs/head/mystring.h
    database/src/so/nodes/nurbs/head/nurbsconsts.h
    database/src/so/nodes/nurbs/head/nurbstess.h
    database/src/so/nodes/nurbs/head/patch.h
    database/src/so/nodes/nurbs/head/patchlist.h
    database/src/so/nodes/nurbs/head/pwlarc.h
    database/src/so/nodes/nurbs/head/quilt.h
    database/src/so/nodes/nurbs/head/reader.h
    database/src/so/nodes/nurbs/head/renderhints.h
    database/src/so/nodes/nurbs/head/slicer.h
    database/src/so/nodes/nurbs/head/sorter.h
    database/src/so/nodes/nurbs/head/subdivider.h
    database/src/so/nodes/nurbs/head/trimline.h
    database/src/so/nodes/nurbs/head/trimregion.h
    database/src/so/nodes/nurbs/head/trimvertex.h
    database/src/so/nodes/nurbs/head/trimvertpool.h
    database/src/so/nodes/nurbs/head/types.h
    database/src/so/nodes/nurbs/head/uarray.h
    database/src/so/nodes/nurbs/head/varray.h
    database/src/so/nodes/nurbs/head/glimports.h
    database/src/so/nodes/nurbs/head/mymath.h
    database/src/so/nodes/nurbs/head/mystdio.h
    database/src/so/nodes/nurbs/head/simplemath.h
    database/src/so/nodes/nurbs/SoAddPrefix.h
    database/src/so/nodes/nurbs/SoCurveMaps.h
    database/src/so/nodes/nurbs/SoCurveRender.h
    database/src/so/nodes/nurbs/SoGLRender.h
    database/src/so/nodes/nurbs/SoPickMaps.h
    database/src/so/nodes/nurbs/SoPickRender.h
    database/src/so/nodes/nurbs/SoPrimMaps.h
    database/src/so/nodes/nurbs/SoPrimRender.h
    database/src/so/nodes/readGIF.h
    database/src/so/upgraders/SoUpgraders.h
    database/src/so/upgraders/SoV1DrawStyle.h
    database/src/so/upgraders/SoV1Environment.h
    database/src/so/upgraders/SoV1IndexedTriangleMesh.h
    database/src/so/upgraders/SoV1LayerGroup.h
    database/src/so/upgraders/SoV1LightModel.h
    database/src/so/upgraders/SoV1Material.h
    database/src/so/upgraders/SoV1PackedColor.h
    database/src/so/upgraders/SoV1PickStyle.h
    database/src/so/upgraders/SoV1Separator.h
    database/src/so/upgraders/SoV1ShapeHints.h
    database/src/so/upgraders/SoV1Text2.h
    database/src/so/upgraders/SoV1Text3.h
    database/src/so/upgraders/SoV1Texture2.h
    database/src/so/upgraders/SoV1TextureCoordinateCube.h
    database/src/so/upgraders/SoV1TextureCoordinateCylinder.h
    database/src/so/upgraders/SoV1TextureCoordinateEnvironment.h
    database/src/so/upgraders/SoV1TextureCoordinatePlane.h
    database/src/so/upgraders/SoV1TextureCoordinateSphere.h
    database/src/so/upgraders/SoV2AsciiText.h
    database/src/so/upgraders/SoV2FontStyle.h
    database/src/so/upgraders/SoV2LOD.h
    database/src/so/upgraders/SoV2MaterialIndex.h
    database/src/so/upgraders/SoV2Text2.h
    database/src/so/upgraders/SoV2Text3.h
    database/src/so/upgraders/SoV2VertexProperty.h
    database/src/so/upgraders/SoV2WWWAnchor.h
    database/src/so/upgraders/SoV2WWWInline.h

    PUBLIC
    database/include/Inventor/Sb.h
    database/include/Inventor/SbBox.h
    database/include/Inventor/SbColor.h
    database/include/Inventor/SbDict.h
    database/include/Inventor/SbString.h
    database/include/Inventor/SbViewportRegion.h
    database/include/Inventor/So.h
    database/include/Inventor/SoDB.h
    database/include/Inventor/SoInput.h
    database/include/Inventor/SoLists.h
    database/include/Inventor/SoOutput.h
    database/include/Inventor/SoPath.h
    database/include/Inventor/SoPickedPoint.h
    database/include/Inventor/SoPrimitiveVertex.h
    database/include/Inventor/SoType.h
    database/include/Inventor/actions/SoAction.h
    database/include/Inventor/actions/SoActions.h
    database/include/Inventor/actions/SoCallbackAction.h
    database/include/Inventor/actions/SoGLRenderAction.h
    database/include/Inventor/actions/SoGetBoundingBoxAction.h
    database/include/Inventor/actions/SoGetMatrixAction.h
    database/include/Inventor/actions/SoHandleEventAction.h
    database/include/Inventor/actions/SoPickAction.h
    database/include/Inventor/actions/SoRayPickAction.h
    database/include/Inventor/actions/SoSearchAction.h
    database/include/Inventor/actions/SoSubAction.h
    database/include/Inventor/actions/SoWriteAction.h
    database/include/Inventor/bundles/SoBundle.h
    database/include/Inventor/bundles/SoMaterialBundle.h
    database/include/Inventor/bundles/SoNormalBundle.h
    database/include/Inventor/bundles/SoTextureCoordinateBundle.h
    database/include/Inventor/caches/SoBoundingBoxCache.h
    database/include/Inventor/caches/SoCache.h
    database/include/Inventor/caches/SoGLCacheList.h
    database/include/Inventor/caches/SoGLRenderCache.h
    database/include/Inventor/caches/SoNormalCache.h
    database/include/Inventor/details/SoConeDetail.h
    database/include/Inventor/details/SoCubeDetail.h
    database/include/Inventor/details/SoCylinderDetail.h
    database/include/Inventor/details/SoDetail.h
    database/include/Inventor/details/SoDetails.h
    database/include/Inventor/details/SoFaceDetail.h
    database/include/Inventor/details/SoLineDetail.h
    database/include/Inventor/details/SoPointDetail.h
    database/include/Inventor/details/SoSubDetail.h
    database/include/Inventor/details/SoTextDetail.h
    database/include/Inventor/elements/SoAccumulatedElement.h
    database/include/Inventor/elements/SoAmbientColorElement.h
    database/include/Inventor/elements/SoBBoxModelMatrixElement.h
    database/include/Inventor/elements/SoCacheElement.h
    database/include/Inventor/elements/SoClipPlaneElement.h
    database/include/Inventor/elements/SoComplexityElement.h
    database/include/Inventor/elements/SoComplexityTypeElement.h
    database/include/Inventor/elements/SoCoordinateElement.h
    database/include/Inventor/elements/SoCreaseAngleElement.h
    database/include/Inventor/elements/SoCullVolumeElement.h
    database/include/Inventor/elements/SoCurrentGLMaterialElement.h
    database/include/Inventor/elements/SoDiffuseColorElement.h
    database/include/Inventor/elements/SoDrawStyleElement.h
    database/include/Inventor/elements/SoElement.h
    database/include/Inventor/elements/SoElements.h
    database/include/Inventor/elements/SoEmissiveColorElement.h
    database/include/Inventor/elements/SoFloatElement.h
    database/include/Inventor/elements/SoFocalDistanceElement.h
    database/include/Inventor/elements/SoFontNameElement.h
    database/include/Inventor/elements/SoFontSizeElement.h
    database/include/Inventor/elements/SoGLAmbientColorElement.h
    database/include/Inventor/elements/SoGLCacheContextElement.h
    database/include/Inventor/elements/SoGLClipPlaneElement.h
    database/include/Inventor/elements/SoGLColorIndexElement.h
    database/include/Inventor/elements/SoGLCoordinateElement.h
    database/include/Inventor/elements/SoGLDiffuseColorElement.h
    database/include/Inventor/elements/SoGLDrawStyleElement.h
    database/include/Inventor/elements/SoGLEmissiveColorElement.h
    database/include/Inventor/elements/SoGLLazyElement.h
    database/include/Inventor/elements/SoGLLightIdElement.h
    database/include/Inventor/elements/SoGLLightModelElement.h
    database/include/Inventor/elements/SoGLLinePatternElement.h
    database/include/Inventor/elements/SoGLLineWidthElement.h
    #database/include/Inventor/elements/SoGLMaterialIndexElement.h
    database/include/Inventor/elements/SoGLModelMatrixElement.h
    database/include/Inventor/elements/SoGLNormalElement.h
    database/include/Inventor/elements/SoGLPointSizeElement.h
    database/include/Inventor/elements/SoGLPolygonStippleElement.h
    database/include/Inventor/elements/SoGLProjectionMatrixElement.h
    database/include/Inventor/elements/SoGLRenderPassElement.h
    database/include/Inventor/elements/SoGLShapeHintsElement.h
    database/include/Inventor/elements/SoGLShininessElement.h
    database/include/Inventor/elements/SoGLSpecularColorElement.h
    database/include/Inventor/elements/SoGLTextureBlendColorElement.h
    database/include/Inventor/elements/SoGLTextureCoordinateElement.h
    database/include/Inventor/elements/SoGLTextureEnabledElement.h
    database/include/Inventor/elements/SoGLTextureImageElement.h
    database/include/Inventor/elements/SoGLTextureMatrixElement.h
    database/include/Inventor/elements/SoGLTextureModelElement.h
    database/include/Inventor/elements/SoGLTextureQualityElement.h
    database/include/Inventor/elements/SoGLTextureWrapSElement.h
    database/include/Inventor/elements/SoGLTextureWrapTElement.h
    database/include/Inventor/elements/SoGLUpdateAreaElement.h
    database/include/Inventor/elements/SoGLViewingMatrixElement.h
    database/include/Inventor/elements/SoGLViewportRegionElement.h
    database/include/Inventor/elements/SoInt32Element.h
    database/include/Inventor/elements/SoLightAttenuationElement.h
    database/include/Inventor/elements/SoLightModelElement.h
    database/include/Inventor/elements/SoLinePatternElement.h
    database/include/Inventor/elements/SoLineWidthElement.h
    database/include/Inventor/elements/SoLocalBBoxMatrixElement.h
    database/include/Inventor/elements/SoLongElement.h
    database/include/Inventor/elements/SoMaterialBindingElement.h
    database/include/Inventor/elements/SoModelMatrixElement.h
    database/include/Inventor/elements/SoNormalBindingElement.h
    database/include/Inventor/elements/SoNormalElement.h
    database/include/Inventor/elements/SoOverrideElement.h
    database/include/Inventor/elements/SoPickRayElement.h
    database/include/Inventor/elements/SoPickStyleElement.h
    database/include/Inventor/elements/SoPointSizeElement.h
    database/include/Inventor/elements/SoProfileCoordinateElement.h
    database/include/Inventor/elements/SoProfileElement.h
    database/include/Inventor/elements/SoProjectionMatrixElement.h
    database/include/Inventor/elements/SoReplacedElement.h
    database/include/Inventor/elements/SoShapeHintsElement.h
    database/include/Inventor/elements/SoShapeStyleElement.h
    database/include/Inventor/elements/SoShininessElement.h
    database/include/Inventor/elements/SoSpecularColorElement.h
    database/include/Inventor/elements/SoSubElement.h
    database/include/Inventor/elements/SoSwitchElement.h
    database/include/Inventor/elements/SoTextureBlendColorElement.h
    database/include/Inventor/elements/SoTextureCoordinateBindingElement.h
    database/include/Inventor/elements/SoTextureCoordinateElement.h
    database/include/Inventor/elements/SoTextureImageElement.h
    database/include/Inventor/elements/SoTextureMatrixElement.h
    database/include/Inventor/elements/SoTextureModelElement.h
    database/include/Inventor/elements/SoTextureQualityElement.h
    database/include/Inventor/elements/SoTextureWrapSElement.h
    database/include/Inventor/elements/SoTextureWrapTElement.h
    database/include/Inventor/elements/SoTransparencyElement.h
    database/include/Inventor/elements/SoUnitsElement.h
    database/include/Inventor/elements/SoViewVolumeElement.h
    database/include/Inventor/elements/SoViewingMatrixElement.h
    database/include/Inventor/elements/SoViewportRegionElement.h
    database/include/Inventor/elements/SoWindowElement.h
    database/include/Inventor/elements/SoLazyElement.h
    database/include/Inventor/engines/SoBoolOperation.h
    database/include/Inventor/engines/SoCalculator.h
    database/include/Inventor/engines/SoCompose.h
    database/include/Inventor/engines/SoComputeBoundingBox.h
    database/include/Inventor/engines/SoConcatenate.h
    database/include/Inventor/engines/SoCounter.h
    database/include/Inventor/engines/SoElapsedTime.h
    database/include/Inventor/engines/SoEngines.h
    database/include/Inventor/engines/SoFieldConverter.h
    database/include/Inventor/engines/SoGate.h
    database/include/Inventor/engines/SoInterpolate.h
    database/include/Inventor/engines/SoOnOff.h
    database/include/Inventor/engines/SoOneShot.h
    database/include/Inventor/engines/SoSelectOne.h
    database/include/Inventor/engines/SoSubEngine.h
    database/include/Inventor/engines/SoTimeCounter.h
    database/include/Inventor/engines/SoTransformVec3f.h
    database/include/Inventor/engines/SoTriggerAny.h
    database/include/Inventor/engines/SoEngine.h
    database/include/Inventor/engines/SoOutputData.h
    database/include/Inventor/errors/SoDebugError.h
    database/include/Inventor/errors/SoError.h
    database/include/Inventor/errors/SoErrors.h
    database/include/Inventor/errors/SoMemoryError.h
    database/include/Inventor/errors/SoReadError.h
    database/include/Inventor/events/SoButtonEvent.h
    database/include/Inventor/events/SoEvent.h
    database/include/Inventor/events/SoEvents.h
    database/include/Inventor/events/SoKeyboardEvent.h
    database/include/Inventor/events/SoLocation2Event.h
    database/include/Inventor/events/SoMotion3Event.h
    database/include/Inventor/events/SoMouseButtonEvent.h
    database/include/Inventor/events/SoSpaceballButtonEvent.h
    database/include/Inventor/events/SoSubEvent.h
    database/include/Inventor/fields/SoField.h
    database/include/Inventor/fields/SoFieldContainer.h
    database/include/Inventor/fields/SoFields.h
    database/include/Inventor/fields/SoMFBitMask.h
    database/include/Inventor/fields/SoMFBool.h
    database/include/Inventor/fields/SoMFColor.h
    database/include/Inventor/fields/SoMFEngine.h
    database/include/Inventor/fields/SoMFEnum.h
    database/include/Inventor/fields/SoMFFloat.h
    database/include/Inventor/fields/SoMFInt32.h
    database/include/Inventor/fields/SoMFLong.h
    database/include/Inventor/fields/SoMFMatrix.h
    database/include/Inventor/fields/SoMFName.h
    database/include/Inventor/fields/SoMFNode.h
    database/include/Inventor/fields/SoMFPath.h
    database/include/Inventor/fields/SoMFPlane.h
    database/include/Inventor/fields/SoMFRotation.h
    database/include/Inventor/fields/SoMFShort.h
    database/include/Inventor/fields/SoMFString.h
    database/include/Inventor/fields/SoMFTime.h
    database/include/Inventor/fields/SoMFUInt32.h
    database/include/Inventor/fields/SoMFULong.h
    database/include/Inventor/fields/SoMFUShort.h
    database/include/Inventor/fields/SoMFVec2f.h
    database/include/Inventor/fields/SoMFVec3f.h
    database/include/Inventor/fields/SoMFVec4f.h
    database/include/Inventor/fields/SoSFBitMask.h
    database/include/Inventor/fields/SoSFBool.h
    database/include/Inventor/fields/SoSFColor.h
    database/include/Inventor/fields/SoSFEngine.h
    database/include/Inventor/fields/SoSFEnum.h
    database/include/Inventor/fields/SoSFFloat.h
    database/include/Inventor/fields/SoSFImage.h
    database/include/Inventor/fields/SoSFInt32.h
    database/include/Inventor/fields/SoSFLong.h
    database/include/Inventor/fields/SoSFMatrix.h
    database/include/Inventor/fields/SoSFName.h
    database/include/Inventor/fields/SoSFNode.h
    database/include/Inventor/fields/SoSFPath.h
    database/include/Inventor/fields/SoSFPlane.h
    database/include/Inventor/fields/SoSFRotation.h
    database/include/Inventor/fields/SoSFShort.h
    database/include/Inventor/fields/SoSFString.h
    database/include/Inventor/fields/SoSFTime.h
    database/include/Inventor/fields/SoSFTrigger.h
    database/include/Inventor/fields/SoSFUInt32.h
    database/include/Inventor/fields/SoSFULong.h
    database/include/Inventor/fields/SoSFUShort.h
    database/include/Inventor/fields/SoSFVec2f.h
    database/include/Inventor/fields/SoSFVec3f.h
    database/include/Inventor/fields/SoSFVec4f.h
    database/include/Inventor/fields/SoSubField.h
    database/include/Inventor/fields/SoFieldData.h
    database/include/Inventor/misc/SoAuditorList.h
    database/include/Inventor/misc/SoBase.h
    database/include/Inventor/misc/SoBasic.h
    database/include/Inventor/misc/SoByteStream.h
    database/include/Inventor/misc/SoCallbackList.h
    database/include/Inventor/misc/SoChildList.h
    database/include/Inventor/misc/SoCompactPathList.h
    database/include/Inventor/misc/SoNormalGenerator.h
    database/include/Inventor/misc/SoNotification.h
    database/include/Inventor/misc/SoState.h
    database/include/Inventor/misc/SoTempPath.h
    database/include/Inventor/misc/SoTranscribe.h
    database/include/Inventor/misc/upgraders/SoUpgrader.h
    database/include/Inventor/misc/upgraders/SoV1CustomNode.h
    database/include/Inventor/nodes/SoAnnotation.h
    database/include/Inventor/nodes/SoArray.h
    database/include/Inventor/nodes/SoAsciiText.h
    database/include/Inventor/nodes/SoBaseColor.h
    database/include/Inventor/nodes/SoBlinker.h
    database/include/Inventor/nodes/SoCallback.h
    database/include/Inventor/nodes/SoCamera.h
    database/include/Inventor/nodes/SoClipPlane.h
    database/include/Inventor/nodes/SoColorIndex.h
    database/include/Inventor/nodes/SoComplexity.h
    database/include/Inventor/nodes/SoCone.h
    database/include/Inventor/nodes/SoCoordinate3.h
    database/include/Inventor/nodes/SoCoordinate4.h
    database/include/Inventor/nodes/SoCube.h
    database/include/Inventor/nodes/SoCylinder.h
    database/include/Inventor/nodes/SoDirectionalLight.h
    database/include/Inventor/nodes/SoDrawStyle.h
    database/include/Inventor/nodes/SoEnvironment.h
    database/include/Inventor/nodes/SoEventCallback.h
    database/include/Inventor/nodes/SoFaceSet.h
    database/include/Inventor/nodes/SoFile.h
    database/include/Inventor/nodes/SoFont.h
    database/include/Inventor/nodes/SoGroup.h
    database/include/Inventor/nodes/SoIndexedFaceSet.h
    database/include/Inventor/nodes/SoIndexedLineSet.h
    database/include/Inventor/nodes/SoIndexedNurbsCurve.h
    database/include/Inventor/nodes/SoIndexedNurbsSurface.h
    database/include/Inventor/nodes/SoIndexedShape.h
    database/include/Inventor/nodes/SoIndexedTriangleStripSet.h
    database/include/Inventor/nodes/SoInfo.h
    database/include/Inventor/nodes/SoLOD.h
    database/include/Inventor/nodes/SoLabel.h
    database/include/Inventor/nodes/SoLevelOfDetail.h
    database/include/Inventor/nodes/SoLight.h
    database/include/Inventor/nodes/SoLightModel.h
    database/include/Inventor/nodes/SoLineSet.h
    database/include/Inventor/nodes/SoLinearProfile.h
    database/include/Inventor/nodes/SoLocateHighlight.h
    database/include/Inventor/nodes/SoMaterial.h
    database/include/Inventor/nodes/SoMaterialBinding.h
    #database/include/Inventor/nodes/SoMaterialIndex.h
    database/include/Inventor/nodes/SoMatrixTransform.h
    database/include/Inventor/nodes/SoMultipleCopy.h
    database/include/Inventor/nodes/SoNode.h
    database/include/Inventor/nodes/SoNodes.h
    database/include/Inventor/nodes/SoNonIndexedShape.h
    database/include/Inventor/nodes/SoNormal.h
    database/include/Inventor/nodes/SoNormalBinding.h
    database/include/Inventor/nodes/SoNurbsCurve.h
    database/include/Inventor/nodes/SoNurbsProfile.h
    database/include/Inventor/nodes/SoNurbsSurface.h
    database/include/Inventor/nodes/SoOrthographicCamera.h
    database/include/Inventor/nodes/SoPackedColor.h
    database/include/Inventor/nodes/SoPathSwitch.h
    database/include/Inventor/nodes/SoPendulum.h
    database/include/Inventor/nodes/SoPerspectiveCamera.h
    database/include/Inventor/nodes/SoPickStyle.h
    database/include/Inventor/nodes/SoPointLight.h
    database/include/Inventor/nodes/SoPointSet.h
    database/include/Inventor/nodes/SoProfile.h
    database/include/Inventor/nodes/SoProfileCoordinate2.h
    database/include/Inventor/nodes/SoProfileCoordinate3.h
    database/include/Inventor/nodes/SoQuadMesh.h
    database/include/Inventor/nodes/SoResetTransform.h
    database/include/Inventor/nodes/SoRotation.h
    database/include/Inventor/nodes/SoRotationXYZ.h
    database/include/Inventor/nodes/SoRotor.h
    database/include/Inventor/nodes/SoScale.h
    database/include/Inventor/nodes/SoSeparator.h
    database/include/Inventor/nodes/SoShape.h
    database/include/Inventor/nodes/SoShapeHints.h
    database/include/Inventor/nodes/SoShuttle.h
    database/include/Inventor/nodes/SoSphere.h
    database/include/Inventor/nodes/SoSpotLight.h
    database/include/Inventor/nodes/SoSubNode.h
    database/include/Inventor/nodes/SoSwitch.h
    database/include/Inventor/nodes/SoText2.h
    database/include/Inventor/nodes/SoText3.h
    database/include/Inventor/nodes/SoTexture2.h
    database/include/Inventor/nodes/SoTexture2Transform.h
    database/include/Inventor/nodes/SoTextureCoordinate2.h
    database/include/Inventor/nodes/SoTextureCoordinateBinding.h
    database/include/Inventor/nodes/SoTextureCoordinateDefault.h
    database/include/Inventor/nodes/SoTextureCoordinateEnvironment.h
    database/include/Inventor/nodes/SoTextureCoordinateFunction.h
    database/include/Inventor/nodes/SoTextureCoordinatePlane.h
    database/include/Inventor/nodes/SoTransform.h
    database/include/Inventor/nodes/SoTransformSeparator.h
    database/include/Inventor/nodes/SoTransformation.h
    database/include/Inventor/nodes/SoTranslation.h
    database/include/Inventor/nodes/SoTriangleStripSet.h
    database/include/Inventor/nodes/SoUnits.h
    #database/include/Inventor/nodes/SoVertexArray.h
    database/include/Inventor/nodes/SoVertexProperty.h
    database/include/Inventor/nodes/SoVertexShape.h
    database/include/Inventor/nodes/SoWWWAnchor.h
    database/include/Inventor/nodes/SoWWWInline.h
    #database/include/Inventor/nodes/glVertArray.h
    database/include/Inventor/nodes/SoFontStyle.h
    database/include/Inventor/projectors/SbCylinderPlaneProjector.h
    database/include/Inventor/projectors/SbCylinderProjector.h
    database/include/Inventor/projectors/SbCylinderSectionProjector.h
    database/include/Inventor/projectors/SbCylinderSheetProjector.h
    database/include/Inventor/projectors/SbLineProjector.h
    database/include/Inventor/projectors/SbPlaneProjector.h
    database/include/Inventor/projectors/SbProjectors.h
    database/include/Inventor/projectors/SbSpherePlaneProjector.h
    database/include/Inventor/projectors/SbSphereProjector.h
    database/include/Inventor/projectors/SbSphereSectionProjector.h
    database/include/Inventor/projectors/SbSphereSheetProjector.h
    database/include/Inventor/projectors/SbProjector.h
    database/include/Inventor/sensors/SoAlarmSensor.h
    database/include/Inventor/sensors/SoDataSensor.h
    database/include/Inventor/sensors/SoDelayQueueSensor.h
    database/include/Inventor/sensors/SoFieldSensor.h
    database/include/Inventor/sensors/SoIdleSensor.h
    database/include/Inventor/sensors/SoNodeSensor.h
    database/include/Inventor/sensors/SoOneShotSensor.h
    database/include/Inventor/sensors/SoPathSensor.h
    database/include/Inventor/sensors/SoSensor.h
    database/include/Inventor/sensors/SoSensorManager.h
    database/include/Inventor/sensors/SoSensors.h
    database/include/Inventor/sensors/SoTimerQueueSensor.h
    database/include/Inventor/sensors/SoTimerSensor.h
    database/include/Inventor/SbBasic.h
    database/include/Inventor/SbLinear.h
    database/include/Inventor/SbPList.h
    database/include/Inventor/SbTime.h
    database/include/Inventor/SoOffscreenRenderer.h
    database/include/SoDebug.h
    database/include/SoUnknownEngine.h
    database/include/SoUnknownNode.h
    database/include/machine.h
)

target_sources(Inventor
    PRIVATE
    interaction/src/actions/SoBoxHL.c++
    interaction/src/actions/SoLineHL.c++
    interaction/src/draggers/SoDraggerInit.c++
    interaction/src/draggers/SoCenterballDragger.c++
    interaction/src/draggers/SoDirectionalLightDragger.c++
    interaction/src/draggers/SoDragPointDragger.c++
    interaction/src/draggers/SoDragger.c++
    interaction/src/draggers/SoHandleBoxDragger.c++
    interaction/src/draggers/SoJackDragger.c++
    interaction/src/draggers/SoPointLightDragger.c++
    interaction/src/draggers/SoRotateCylindricalDragger.c++
    interaction/src/draggers/SoRotateDiscDragger.c++
    interaction/src/draggers/SoRotateSphericalDragger.c++
    interaction/src/draggers/SoScale1Dragger.c++
    interaction/src/draggers/SoScale2Dragger.c++
    interaction/src/draggers/SoScale2UniformDragger.c++
    interaction/src/draggers/SoScaleUniformDragger.c++
    interaction/src/draggers/SoSpotLightDragger.c++
    interaction/src/draggers/SoTabBoxDragger.c++
    interaction/src/draggers/SoTabPlaneDragger.c++
    interaction/src/draggers/SoTrackballDragger.c++
    interaction/src/draggers/SoTransformBoxDragger.c++
    interaction/src/draggers/SoTransformerDragger.c++
    interaction/src/draggers/SoTranslate1Dragger.c++
    interaction/src/draggers/SoTranslate2Dragger.c++
    interaction/src/manips/SoManips.c++
    interaction/src/nodekits/SoInteractionKit.c++
    interaction/src/nodes/SoAntiSquish.c++
    interaction/src/nodes/SoSurroundScale.c++
    interaction/src/SoInteraction.c++
    interaction/src/SoSceneMgr.c++
    interaction/src/SoSelection.c++
    interaction/src/draggers/geom/SoCenterballDraggerGeom.h
    interaction/src/draggers/geom/SoDirectionalLightDraggerGeom.h
    interaction/src/draggers/geom/SoDragPointDraggerGeom.h
    interaction/src/draggers/geom/SoHandleBoxDraggerGeom.h
    interaction/src/draggers/geom/SoJackDraggerGeom.h
    interaction/src/draggers/geom/SoPointLightDraggerGeom.h
    interaction/src/draggers/geom/SoRotateCylindricalDraggerGeom.h
    interaction/src/draggers/geom/SoRotateDiscDraggerGeom.h
    interaction/src/draggers/geom/SoRotateSphericalDraggerGeom.h
    interaction/src/draggers/geom/SoScale1DraggerGeom.h
    interaction/src/draggers/geom/SoScale2DraggerGeom.h
    interaction/src/draggers/geom/SoScale2UniformDraggerGeom.h
    interaction/src/draggers/geom/SoScaleUniformDraggerGeom.h
    interaction/src/draggers/geom/SoSpotLightDraggerGeom.h
    interaction/src/draggers/geom/SoTabBoxDraggerGeom.h
    interaction/src/draggers/geom/SoTabPlaneDraggerGeom.h
    interaction/src/draggers/geom/SoTrackballDraggerGeom.h
    interaction/src/draggers/geom/SoTransformBoxDraggerGeom.h
    interaction/src/draggers/geom/SoTransformerDraggerGeom.h
    interaction/src/draggers/geom/SoTranslate1DraggerGeom.h
    interaction/src/draggers/geom/SoTranslate2DraggerGeom.h

    PUBLIC
    interaction/include/Inventor/SoInteraction.h
    interaction/include/Inventor/SoSceneManager.h
    interaction/include/Inventor/actions/SoBoxHighlightRenderAction.h
    interaction/include/Inventor/actions/SoLineHighlightRenderAction.h
    interaction/include/Inventor/draggers/SoCenterballDragger.h
    interaction/include/Inventor/draggers/SoDirectionalLightDragger.h
    interaction/include/Inventor/draggers/SoDragPointDragger.h
    interaction/include/Inventor/draggers/SoDragger.h
    interaction/include/Inventor/draggers/SoHandleBoxDragger.h
    interaction/include/Inventor/draggers/SoJackDragger.h
    interaction/include/Inventor/draggers/SoPointLightDragger.h
    interaction/include/Inventor/draggers/SoRotateCylindricalDragger.h
    interaction/include/Inventor/draggers/SoRotateDiscDragger.h
    interaction/include/Inventor/draggers/SoRotateSphericalDragger.h
    interaction/include/Inventor/draggers/SoScale1Dragger.h
    interaction/include/Inventor/draggers/SoScale2Dragger.h
    interaction/include/Inventor/draggers/SoScale2UniformDragger.h
    interaction/include/Inventor/draggers/SoScaleUniformDragger.h
    interaction/include/Inventor/draggers/SoSpotLightDragger.h
    interaction/include/Inventor/draggers/SoTabBoxDragger.h
    interaction/include/Inventor/draggers/SoTabPlaneDragger.h
    interaction/include/Inventor/draggers/SoTrackballDragger.h
    interaction/include/Inventor/draggers/SoTransformBoxDragger.h
    interaction/include/Inventor/draggers/SoTransformerDragger.h
    interaction/include/Inventor/draggers/SoTranslate1Dragger.h
    interaction/include/Inventor/draggers/SoTranslate2Dragger.h
    interaction/include/Inventor/manips/SoCenterballManip.h
    interaction/include/Inventor/manips/SoDirectionalLightManip.h
    interaction/include/Inventor/manips/SoHandleBoxManip.h
    interaction/include/Inventor/manips/SoJackManip.h
    interaction/include/Inventor/manips/SoPointLightManip.h
    interaction/include/Inventor/manips/SoSpotLightManip.h
    interaction/include/Inventor/manips/SoTabBoxManip.h
    interaction/include/Inventor/manips/SoTrackballManip.h
    interaction/include/Inventor/manips/SoTransformBoxManip.h
    interaction/include/Inventor/manips/SoTransformManip.h
    interaction/include/Inventor/manips/SoTransformerManip.h
    interaction/include/Inventor/nodekits/SoInteractionKit.h
    interaction/include/Inventor/nodes/SoAntiSquish.h
    interaction/include/Inventor/nodes/SoSelection.h
    interaction/include/Inventor/nodes/SoSurroundScale.h
)

target_sources(Inventor
    PRIVATE
    nodekits/src/details/SoNodeKitDetail.c++
    nodekits/src/nodekits/SoNodeKits.c++
    nodekits/src/upgraders/SoNodeKitUpgraders.c++
    nodekits/src/SoNodeKitPath.c++

    PUBLIC
    nodekits/include/Inventor/SoNodeKitPath.h
    nodekits/include/Inventor/details/SoNodeKitDetail.h
    nodekits/include/Inventor/misc/upgraders/SoV1AppearanceKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1BaseKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1CameraKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1ConeKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1CubeKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1CylinderKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1DirectionalLightKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1FaceSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1GroupKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1IndexedFaceSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1IndexedLineSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1IndexedNurbsCurveKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1IndexedNurbsSurfaceKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1IndexedTriangleMeshKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1LightKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1LineSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1NodeKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1NodekitCatalog.h
    nodekits/include/Inventor/misc/upgraders/SoV1NodekitParts.h
    nodekits/include/Inventor/misc/upgraders/SoV1NurbsCurveKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1NurbsSurfaceKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1OrthographicCameraKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1PerspectiveCameraKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1PointLightKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1PointSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1QuadMeshKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1SceneKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1ShapeKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1SphereKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1SpotLightKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1SubKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1Text2Kit.h
    nodekits/include/Inventor/misc/upgraders/SoV1Text3Kit.h
    nodekits/include/Inventor/misc/upgraders/SoV1TriangleStripSetKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1VertexShapeKit.h
    nodekits/include/Inventor/misc/upgraders/SoV1WrapperKit.h
    nodekits/include/Inventor/nodekits/SoAppearanceKit.h
    nodekits/include/Inventor/nodekits/SoBaseKit.h
    nodekits/include/Inventor/nodekits/SoCameraKit.h
    nodekits/include/Inventor/nodekits/SoLightKit.h
    nodekits/include/Inventor/nodekits/SoNodeKit.h
    nodekits/include/Inventor/nodekits/SoNodeKitListPart.h
    nodekits/include/Inventor/nodekits/SoNodekitCatalog.h
    nodekits/include/Inventor/nodekits/SoNodekitParts.h
    nodekits/include/Inventor/nodekits/SoSceneKit.h
    nodekits/include/Inventor/nodekits/SoSeparatorKit.h
    nodekits/include/Inventor/nodekits/SoShapeKit.h
    nodekits/include/Inventor/nodekits/SoWrapperKit.h
    nodekits/include/Inventor/nodekits/SoSubKit.h
)

set_property(SOURCE
    database/src/so/engines/SoEngines.c++
    APPEND PROPERTY OBJECT_DEPENDS lib/SoCalcParse.c++
)

target_compile_definitions(Inventor PRIVATE LIBRARYBUILD)

target_include_directories(Inventor PRIVATE database/src/so/nodes/nurbs/head)
target_include_directories(Inventor PRIVATE database/src/so/engines)

target_include_directories(Inventor PUBLIC
    database/include
    interaction/include
    nodekits/include
)

target_link_libraries(Inventor PUBLIC OpenGL::GL)
target_link_libraries(Inventor PUBLIC OpenGL::GLU)

target_link_libraries(Inventor PRIVATE FLiv)

target_link_libraries(Inventor PRIVATE image)

target_link_libraries(Inventor PRIVATE JPEG::JPEG)

target_link_libraries(Inventor PRIVATE X11::X11)

target_link_libraries(Inventor PRIVATE Iconv::Iconv)

if (CMAKE_DL_LIBS)
    target_link_libraries(Inventor PRIVATE ${CMAKE_DL_LIBS})
endif()

set_target_properties(Inventor PROPERTIES
    VERSION ${CMAKE_PROJECT_VERSION}
    SOVERSION ${INVENTOR_SOVERSION}
)

install(TARGETS Inventor)

install(DIRECTORY database/include/Inventor/ interaction/include/Inventor/ nodekits/include/Inventor/
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${IVHDRTOP}
    FILES_MATCHING
    PATTERN "*.h"
    PATTERN "glVertArray.h" EXCLUDE
    PATTERN "SoGLMaterialIndexElement.h" EXCLUDE
    PATTERN "SoMaterialIndex.h" EXCLUDE
    PATTERN "SoVertexArray.h" EXCLUDE
)
